#include "Platform/OpenGL/openGLContext.h"
#include "Core/log.h"

namespace CC {

	OpenGLContext::OpenGLContext(GLFWwindow* windowHandle)
		: m_WindowHandle(windowHandle)
	{
	}

	void OpenGLContext::Init()
	{

		glfwMakeContextCurrent(m_WindowHandle);
		int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);

        CC_CORE_INFO("OpenGL Info: %d\n", status);
		// printf("Vendor-%s\n", glGetString(GL_VENDOR));
		// printf("Renderer-%s\n", glGetString(GL_RENDERER));
		// printf("Version-%s\n", glGetString(GL_VERSION));
        CC_CORE_INFO("  Vendor: {%s}\n", glGetString(GL_VENDOR));
        CC_CORE_INFO("  Renderer: {%s}\n", glGetString(GL_RENDERER));
        CC_CORE_INFO("  Version: {%s}\n", glGetString(GL_VERSION));

		

		// HZ_CORE_ASSERT(GLVersion.major > 4 || (GLVersion.major == 4 && GLVersion.minor >= 5), "Hazel requires at least OpenGL version 4.5!");
	}

	void OpenGLContext::SwapBuffers()
	{
		glfwSwapBuffers(m_WindowHandle);
	}

}
